import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n
import Print from 'vue-print-nb'
import App from './App'
import store from './store'
import router from './router'
import '@/styles/index.scss'
import '@/icons' // icon
import '@/permission' // permission control
// import { imgerror, color } from '@/directives'
// 自定义指令全部导入
import * as directives from './directives'
// 批量注册自定义指令
Object.keys(directives).forEach((item) => {
  Vue.directive(item, directives[item])
})

// 注册组件
// import PageTools from '@/components/PageTools'
// Vue.component('PageTools', PageTools)
// 封装组件注册
// import component from './components'
// Vue.use(component)
import * as component from './components'
Object.keys(component).forEach((item) => {
  Vue.use(component[item])
})
// 批量注册过滤器
import * as filters from './filters'
Object.keys(filters).forEach((item) => {
  Vue.filter(item, filters[item])
})
// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)
Vue.use(Print)
// 自定义指令
// Vue.directive('imgerror', imgerror)
// Vue.directive('color', color)
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
